package jjn.acwing.java_basic;

import java.io.*;
import java.util.Map;
import java.util.TreeMap;


/**
 * @author Jiang Jining
 * @since 2023-09-13 23:25
 */
public class Acwing136 {
    public static void main(String[] args) throws IOException {
        TreeMap<Integer, Integer> map = new TreeMap<>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[n];
        String line = br.readLine();
        String[] numbers = line.split(" ");
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(numbers[i]);
        }
        map.put(arr[0], 0);
        for (int i = 1; i < n; i++) {
            Map.Entry<Integer, Integer> up = map.ceilingEntry(arr[i]);
            Map.Entry<Integer, Integer> down = map.floorEntry(arr[i]);
            int d = Integer.MAX_VALUE, pos = -1;
            if (up != null) {
                d = up.getKey() - arr[i];
                pos = up.getValue();
            }
            if (down != null && arr[i] - down.getKey() <= d) {
                d = arr[i] - down.getKey();
                pos = down.getValue();
            }
            
            bw.write(d + " " + (pos + 1) + "\n");
            map.put(arr[i], i);
        }
        bw.flush();
    }
}
